package dryven.request.controller.paramtransform.baseimpl;

import java.lang.annotation.Annotation;

import dryven.request.controller.paramtransform.ActionParameterBindCandidate;
import dryven.request.controller.paramtransform.ActionParameterTransformFeedback;
import dryven.request.controller.result.ActionFeedback;
import dryven.request.http.Request;
import dryven.request.http.Response;

public class RequestBinder implements ActionParameterBindCandidate {

	@Override
	public void apply(Class<?> type, Annotation[] annotations,
			Object currentValue, Request request, Response response,
			ActionParameterTransformFeedback feedback) {
		if(type.equals(Response.class)) {
			feedback.setParameter(response);
		}
		else if(type.equals(Request.class)) {
			feedback.setParameter(request);
		}
		/*else if(type.equals(ActionFeedback.class)) {
			feedback.setParameter(new ActionFeedback(request,response));
		}*/
	}

	@Override
	public boolean canApply(Class<?> type, Annotation[] annotations) {
		return type.equals(Request.class) || type.equals(Response.class);
	}

	@Override
	public boolean isValueGenerator() {
		return true;
	}

	@Override
	public String serializeParameter(Object o) {
		return null;
	}

}
